/*
 * Copyright (c) 2024 Huawei Device Co., Ltd.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

#include "include/cpp/abckit_cpp.h"
#include "tests/mock/check_mock.h"
#include "src/mock/mock_values.h"
#include "tests/mock/cpp_helpers_mock.h"
#include <gtest/gtest.h>

namespace libabckit::cpp_test {

class LibAbcKitCppMockTest : public ::testing::Test {};

% parsed_functions.each do |api_func|
// Test: test-kind=mock, api=<%= getClass(api_func) %>::<%= getName(api_func) %>, abc-kind=ArkTS1, category=internal, extension=cpp
TEST_F(LibAbcKitCppMockTest<%= getClass(api_func) %>, <%= getClass(api_func) %>_<%= getName(api_func) %>)
{
    ASSERT_TRUE(CheckMockedStackEmpty());
    {
        abckit::File f(DEFAULT_PATH);
        ASSERT_TRUE(CheckMockedApi("OpenAbc"));
%  if getClass(api_func) == "DynamicIsa"
        abckit::mock::helpers::GetMockGraph(f).DynIsa().<%= getName(api_func)%>(<%= generateArgsFromHelpers(getFuncArgs(api_func))%>);
%  else
        abckit::mock::helpers::GetMock<%= getClass(api_func) %>(f).<%= getName(api_func)%>(<%= generateArgsFromHelpers(getFuncArgs(api_func))%>);
%  end
        ASSERT_TRUE(CheckMockedApi("<%= getClass(api_func)%><%= fixCppApiName(api_func) %>"));
%   getFuncArgs(api_func).each do | arg |
%    if arg[arg.length - 2].include?("std\:\:string")
        ASSERT_TRUE(CheckMockedApi("CreateString"));
%    end
%   end
    }
    ASSERT_TRUE(CheckMockedApi("CloseFile"));
    ASSERT_TRUE(CheckMockedStackEmpty());
}

% end

}  // libabckit::cpp_test